import request from '@/utils/request'
import type { categoryResponseData, category } from './model/attr'
enum API {
   C1 = '/admin/product/getCategory1', //一级分类接口
   C2 = '/admin/product/getCategory2', //一级分类接口
   C3 = '/admin/product/getCategory3',//一级分类接口
   ATTRLIST = '/admin/product/attrInfoList',//获取平台品牌属性数据
   ADDORUPDATEATTR = '/admin/product/saveAttrInfo',// 添加属性|修改属性
   REMOVEATTR=' /admin/product/getAttrValueList/', //修改平台属性
   DELETEATTR='/admin/product/deleteAttr/',
}

//一级分类接口请求
export const reqC1List = () => request.get<any, categoryResponseData>(API.C1)
//二级分类接口请求
export const reqC2List = (category1Id: number | string) => request.get<any, categoryResponseData>(API.C2 + `/${category1Id}`)
//三级分类接口请求
export const reqC3List = (category2Id: number | string) => request.get<any, categoryResponseData>(API.C3 + `/${category2Id}`)
//获取平台品牌属性数据
export const reqAttrList = (category1Id: number | string, category2Id: number | string, category3Id: number | string) => request.get<any, any>(API.ATTRLIST + `/${category1Id}/${category2Id}/${category3Id}`)
//添加或者修改平台属性的接口
export const reqAddOrUpdateAttr = (data: any) => request.post(API.ADDORUPDATEATTR, data)
//删除平台属性接口
export const reqDeleteAttr=(attrId:number)=>request.delete(API.DELETEATTR+`${attrId}`)
